# GitHub
Url address:https://github.com/ThinkiumGroup/web3j
# Env
JDK version: 1.8
Before performing all on-chain interaction interfaces, get the connection instance web3j firstly. The httpService parameter is the RPC address (note that version V2 is used).
protected static final Web3j web3j = Web3j.load(new HttpService("http://test.thinkiumrpc.net/v2"));
# base-chain-id
before use, speicify base-chain-id via following codes
Transaction.chainIdBase = 60000L; // in test environment
Transaction.chainIdBase = 70000; // in production environment
# 1. Get account balance(web3.GetAccount)
Request parameter:
name | type | required | description |
---|---|---|---|
chainId | int | true | chainId |
address | string | true | The account address |
Response parameters:
name | type | required | description |
---|---|---|---|
address | string | true | The account address |
nonce | int | true | The number of previous transactions till now |
balance | bigint | true | balance of account |
storageRoot | string | false | Hash of storage data of contract(No contract returns null) |
codeHash | string | false | The hash of the contract code(No contract returns null) |
Example:
String chainId="2";
String address="0x2c7536e3605d9c16a7a3d7b1898e529396a65c23";
Map map=web3.GetAccount(chainId,address);
System.out.println(map);
Response:
{
"address": "0x2c7536e3605d9c16a7a3d7b1898e529396a65c23",
"balance": 1e+27,
"codeHash": null,
"nonce": 8,
"storageRoot": null
}
# 2. Execute a Transaction on Chain(web3.SendTX)
Request parameter::
name | type | required | description |
---|---|---|---|
chainId | string | true | chainId |
fromChainId | string | true | The chain ID of the transaction sent |
toChainId | string | true | The chain ID of the transaction accepted |
from | string | true | The account address of transaction sent |
to | string | true | The account address of transaction accepted |
nonce | string | true | The number of previous transactions till now |
value | string | true | transfer amount |
input | string | true | arguments when the contract is called |
sig | string | true | transaction signature |
pub | string | true | public key |
Response parameter :
name | type | required | description |
---|---|---|---|
TXhash | string | true | transaction hash |
Sample request:
String chainId22="2";
String fromChainId="2";
String toChainId="2";
//Using the signature method
String sig="0x3c0c75b4dea8c8335475d462bd12dae9e746e3532c6a6b2791cafca565c6610a429fb7260e2f3c64b8e6eb090ee123db700ed2c5f0a4d9a314152f721f0a847101";
String pub="0x044e3b81af9c2234cad09d679ce6035ed1392347ce64ce405f5dcd36228a25de6e47fd35c4215d1edf53e6f83de344615ce719bdb0fd878f6ed76f06dd277956de";
String from="0x2c7536e3605d9c16a7a3d7b1898e529396a65c23";
String to="0x6ea0fefc17c877c7a4b0f139728ed39dc134a967";
String nonce="33";
String value="2333";
String input="";
int ExpireHeight=0;
Map mapresult=web3.SendTx(chainId22,fromChainId,toChainId,sig,pub,from,to,nonce,value,input,ExpireHeight);
System.out.println(mapresult);
Response:
response:
{
"TXhash": "0x22024c2e429196ac76d0e557ac0cf6141f5b500c56fde845582b837c9dab236b"
}
# 3. Get the transaction detail by transaction hash(web3.GetTransactionByHash)
Request parameter::
name | type | required | description |
---|---|---|---|
chainId | string | true | chainId |
hash | string | true | transaction hash |
Response parameter:
name | type | required | description |
---|---|---|---|
Transaction | dict | true | transaction detail |
root | string | true | the current state of the account when the Receipt object was created |
status | int | true | transaction Status: 1: Success, 0: Failure |
logs | array[dict] | false | A group of log generated by this transaction |
transactionHash | string | true | transaction hash |
contractAddress | string | true | contract account address |
out | string | true | the return data of calling |
Transaction:
name | type | required | description |
---|---|---|---|
chainID | int | true | chainID |
from | string | true | The account address of transaction sent |
to | string | true | The account address of transaction accepted |
nonce | string | true | The number of previous transactions till now |
val | string | true | transfer amount |
input | string | true | arguments when the contract is called |
Sample request:
chainId="3";
String hash="0xb298a034848ea3fccf421824c9bc42d1525994843fcda67fd01ca66f16128ebe";
Map maptx=web3.GetTransactionByHash(chainId,hash);
System.out.println(maptx);
Response:
{
"Transaction": {
"chainID": 3,
"from": "0x2c7536e3605d9c16a7a3d7b1898e529396a65c23",
"input": "0x95000000022c7536e3605d9c16a7a3d7b1898e529396a65c230000000000000042000000034fa1c4e6182b6b7f3bca273390cf587b50b473110000000000045644010102a304471cc04daacb7b7c7aedc99641e5ca5698acae3026669f3939f6757f239afc6bf6aefc94941093a1a0df8e3f6a5bf468075826c85d00b1c83ff3b1268f6e8fcbf4b1b090fc02a06021c200008080940d934080c20028808100017a92957e842499e3eb05f3e89683be8d14dd8e753f3b02355dbf39eccfb3d6b20001019403934080c2ffff8081000495f5abd6dfe47cfa3bcfdf88a636d92f7047dbc6b2fabb33da5c71c21e193989451a4767cd1265d629f7c4a6dc298704c2f9d9342c603d11220ca99dffff70ea0c32794c7415e80e33bf93bf6fcdd8ddd2260197fab5690601451612729506523ec792c1c2439978bd9cb5c23d3dc06649cfccaef1d5ef9dd5c507d1cc9c2a6a0001039424930080c20000c08f919b95ead8dbcf25cb16eb3b6d7bc79ce9e6af2823e377e44f1d725f2f056e810005fcb6c9e006ebd8699e4b0aa00a1391e2b3aca513e7fca5fb3c4098deed27a593bb8ef4e4dce46ba0743ecaf6e7fe2f916324512d1725cea4e15cebb6e821bcfb1c41807fcb3b674579cd535c46f2822bb70ee83200ad68576b064c21d2e01690eca078605c1b0ad6ff4323f7c23307585d3dddd504f96e7a7f722f9802d2a1b74fca1f5de7c524d6658648ee28c95512adc78dcd0f440b2fd6600cc51ea2326e000110",
"nonce": 17,
"to": "0x0000000000000000000000000000000000030000",
"value": 0
},
"blockHeight": 280293,
"contractAddress": "0x0000000000000000000000000000000000000000",
"logs": null,
"out": "0x3d8e3f6a5bf468075826c85d00b1c83ff3b1268f6e8fcbf4b1b090fc02a06021",
"root": null,
"status": 1,
"transactionHash": "0x265954c4863005eba23c57d3fb321626979e3c34d84e3b8ae967719f7b3192e4"
}
# 4. Get the chain information(web3.getStats)
Request parameter:
name | type | required | description |
---|---|---|---|
chainId | string | true | chainId |
Response parameter:
name | type | required | description |
---|---|---|---|
currentheight | bigint | true | the current height of blockchain |
txcount | int | true | the total number of transactions |
tps | int | true | transactions per second |
tpsLastEpoch | int | true | transactions per seconds in the previous Epoch |
lives | int | true | the lived duration of chain |
accountcount | int | true | account number |
epochlength | int | true | the number of blocks that current epoch contains |
epochduration | int | true | the current epoch duration lasts |
lastepochduration | int | true | the previous epoch duration lasts |
currentcomm | array | true | the current committee member of this chain |
Sample request:
ChainId="2";
Map mapstas=web3.GetStats(chainId);
System.out.println(mapstas);
Response:
{
"accountcount": 0,
"currentcomm": [
"0x6e4a2f626a7d6dd082b713acdd3be49872097ab79f664f807095f665a50c68803688d1a242c8580ce6e8355468f666d1d43e3bdb0deebd0df17f97e1ea397355",
"0xd1f889690f8c75bbada89a4c8893b8bf6fe29be3b5c3d8a2d772024a340d59d375f39ed88498666a57da10af885ad63a414f8a10153fb739eb1ebfcef57cc883",
"0xa9d8dd87c9ece1787cbb16ba179df6d1d4b29580c03ae1da6e4634b154f8e2feb052fc1c07ca1e362f9b3e2b5f43822df9dd6578e782701de83afeca91a7b453"
],
"currentheight": 280413,
"epochduration": 202,
"epochlength": 80,
"lastepochduration": 202,
"lives": 64362,
"tps": 0,
"tpsLastEpoch": 0,
"txcount": 10
}
# 5. Gets the transactions of one account in a certain range height of chain (web3.GetTransactions)
Request parameter:
name | type | required | description |
---|---|---|---|
chainId | string | true | chainId |
address | string | true | account address |
startHeight | string | true | the start block height of the query |
endHeight | string | true | the end block height of the query |
Response parameter :
name | type | required | description |
---|---|---|---|
chainId | int | true | chainId |
from | string | true | the account address of transaction sent |
to | string | true | the account address of transaction accepted |
nonce | int | true | the number of previous transactions till now |
value | int | true | transfer amount |
timestamp | int | true | the timestamp of the transaction |
input | string | true | arguments when the contract is called |
hash | string | true | transaction hash |
Sample request:
String chainIdtxs="2";
String address_gettx="0x2c7536e3605d9c16a7a3d7b1898e529396a65c23";
String startHeight="50";
String endHeight="100";
JSONArray arr=web3.GetTransactions(chainIdtxs,address_gettx,startHeight,endHeight);
System.out.println(arr);
Response:
[
{
"chainId": 2,
"from": "0x2c7536e3605d9c16a7a3d7b1898e529396a65c23",
"to": "0x4b69a38eed4c24fb85ca79146d7c07392136e178",
"nonce": 0,
"value": 100000,
"input": "0x",
"hash": "0x473de49860222d0eb72a94544d31b87ecf5079f51f7dc619a61828ff8e903a0e",
"timestamp": 1563332880
}
]
# 6. Call Transaction(web3.CallTransaction)
Request parameter:
name | type | required | description |
---|---|---|---|
chainId | string | true | chainId |
fromChainId | string | true | the chain ID of the The account address of transaction sent |
toChainId | string | true | the chain ID address of the transaction acceptance account |
from | string | true | the account address of transaction sent |
to | string | true | the account address of transaction accepted |
nonce | int | true | the number of previous transactions till now |
value | int | true | transfer amount |
input | string | true | arguments when the contract is called |
Response parameter:
name | type | required | description |
---|---|---|---|
chainId | int | true | chainId |
from | string | true | the account address of transaction sent |
to | string | true | the account address of transaction accepted |
nonce | int | true | the number of previous transactions till now |
value | int | true | transfer amount |
input | string | true | arguments when the contract is called |
hash | string | true | transaction hash |
timestamp | int | true | timestamp |
root | string | true | the current state of the Account when the Receipt object was created |
status | int | true | transaction status: 1: Success, 0: Failure |
logs | array[dict] | true | a group of logs generated by this transaction |
transactionHash | string | true | transaction hash |
contractAddress | string | true | contract account address |
out | string | true | the return data of calling |
blockHeight | int | true | block height |
Sample request:
Transaction info_call=new Transaction();
info_call.setChainId("2");
info_call.setFrom("0x0000000000000000000000000000000000000000");
info_call.setTo("0x0e50cea0402d2a396b0db1c5d08155bd219cc52e");
info_call.setNonce("15");
info_call.setValue("0");
info_call.setInput("0xdfc02018");
info_call.setFromChainId("2");
info_call.setToChainId("2");
Map calltrResult=web3.CallTransaction(info_call);
System.out.println(calltrResult);
Response:
{
"Transaction":{
"input":"0xdfc02018",
"chainId":2,
"from":"0x0000000000000000000000000000000000000000",
"to":"0x0e50cea0402d2a396b0db1c5d08155bd219cc52e",
"nonce":0,
"value":0,
"hash":"",
"timestamp":0
},
"blockHeight":0,
"root":"",
"contractAddress":"0x0000000000000000000000000000000000000000",
"logs":"",
"transactionHash":"0xb5a31778f88df4816701e73d1cd67df8b836881766aeb93f3ba8c36bb37f7808",
"status":1,
"out":"0x"
}
# 7. Get the height of block(web3.GetBlockHeader)
Request parameter:
name | type | required | description |
---|---|---|---|
chainId | string | true | chainId |
height | string | true | the block height of query |
Response parameter:
name | type | required | description |
---|---|---|---|
hash | string | true | the hash of this block |
previoushash | string | true | the hash of the parent block |
chainid | int | true | chainid |
height | int | true | block height of query |
mergeroot | string | true | root hash of merging other chain transfered data |
deltaroot | string | true | root hash of cross-chain transfered data |
stateroot | string | true | root hash of state |
txcount | int | true | the total number of transactions |
timestamp | int | true | timestamp |
Sample request:
String height="30";
Map mapHeightr=web3.GetBlockHeader(chainId2,height);
System.out.println(mapHeightr);
Response:
{
"hash": "0x71603186004fd46d32cda0780c4f4cf77ce13b396b1b8132b2c632173441b9d2",
"previoushash": "0xd0f6e9c89eb6be655632911e3743b5a994423c3526653dc55b62ebea3ff56c43",
"chainid": 2,
"height": 30,
"mergeroot": "0xdddfde85423a0d7da064c1b5a8cc1ff18d4a209027ef95ecceae0e6ed8f7c1af",
"deltaroot": "0xdddfde85423a0d7da064c1b5a8cc1ff18d4a209027ef95ecceae0e6ed8f7c1af",
"stateroot": "0x0b672749b02da6bf8f3aa50238140ce7fae5af3e926d4eb06d4cfb707a90702e",
"txcount": 1,
"timestamp": 1547777358
}
# 8. Gets the transaction of specified block(web3.getBlockTxs)
Request parameter::
name | type | required | description |
---|---|---|---|
chainId | string | true | chainId |
height | string | true | the block height of query |
page | string | true | page number |
size | string | true | the size of the page |
Response parameter :
name | type | required | description |
---|---|---|---|
elections | dict | true | |
accountchanges | array | true | information |
accountchanges:
name | type | required | description |
---|---|---|---|
chainId | string | true | chainId |
height | int | true | the starting block height of the query |
from | string | true | the account address of transaction sent |
to | string | true | the account address of transaction accepted |
nonce | int | true | the number of previous transactions till now |
value | int | true | transfer amount |
timestamp | int | true | the timestamp of the transaction |
Sample request:
String height84="84";
String page="1";
String size="10";
Map maptxs=web3.GetBlockTxs(chainId2,height84,page,size);
System.out.println(maptxs);
Response:
{
"elections": null,
"accountchanges": [
{
"chainid": 2,
"height": 30,
"from": "0x4fa1c4e6182b6b7f3bca273390cf587b50b47311",
"to": "0x4fa1c4e6182b6b7f3bca273390cf587b50b47311",
"nonce": 30,
"value": 1,
"timestamp": 1547777358
}
]
}
# 9 Call Contract Functions
//Generate:abi and bin Command:solc Greeter.sol --bin --abi --optimize -o ./output/ Solc Tool Download Address: https://github.com/ethereum/solidity/releases/tag/v0.4.25 Output Generated Directory : .abi and .bin
# 9.1 Deploy Contract(Contract.Deploy)
Request parameter::
name | type | required | description |
---|---|---|---|
Transaction | Transaction | true | transaction entity model |
binContent | string | true | the content of the generated bin file |
parameters | List:Type | true | input parameters |
Response parameter:
name | type | required | description |
---|---|---|---|
TXhash | string | true | transaction hash |
Sample request:
//Deploy the contract
Map result= Contract.Deploy(info,binContent, Collections.emptyList());
System.out.println("sendtx result :" +result);
Thread.sleep(5000); //Delay for 5 seconds
Response:
{
"TXhash":"0xbcf864ce51279dbe23866c216a22e4cda4bde5464fb35f68ee9efca0c040e2e5"
}
# 9.2 Contract Tx Send -require consensus and modify the data state (Contract.Send)
Request parameter::
name | type | required | description |
---|---|---|---|
Transaction | Transaction | true | transaction entity model |
function | Function | true | function |
Response parameter:
name | type | required | description |
---|---|---|---|
TXhash | string | true | transaction hash |
Sample request:
Map resultSend= Contract.Send(info,function1);
System.out.println("resultSend : "+resultSend);
Response:
{
"TXhash":"0xbcf864ce51279dbe23866c216a22e4cda4bde5464fb35f68ee9efca0c040e2e5"
}
# 9.3 contract call - get data from a local node(Contract.Call)
Request parameter::
name | type | required | description |
---|---|---|---|
Transaction | Transaction | true | transaction entity model |
function | Function | true | function |
Response parameter:
name | type | required | description |
---|---|---|---|
Transaction | Transaction | true | transaction entity model |
blockHeight | int | true | block height |
root | string | true | the current state of the account when the Receipt object was created |
contractAddress | string | true | contract address |
logs | string | true | log |
transactionHash | string | true | transaction hash |
status | int | true | transation status: 1 success 0 failure |
out | string | true | the return data of calling |
Transaction:
name | type | required | description |
---|---|---|---|
chainId | string | true | chainId |
from | string | true | the account address of transaction sent |
to | string | true | the account address of transaction accepted |
nonce | int | true | the number of previous transactions till now |
value | int | true | transfer amount |
timestamp | int | true | the timestamp of the transaction |
input | string | true | arguments when the contract is called |
hash | string | true | transaction hash |
Sample request:
Map resultCall= Contract.Call(info,function);
System.out.println(resultCall);
Response:
{
"Transaction":{
"input":"0xcfae3217",
"chainId":2,
"from":"0x2c7536e3605d9c16a7a3d7b1898e529396a65c23",
"to":"0xd39df28bd62f487a2272ce9df499167de16373bb",
"nonce":345,
"value":0,
"hash":"",
"timestamp":0
},
"blockHeight":0,
"root":"",
"contractAddress":"0x0000000000000000000000000000000000000000",
"logs":"",
"transactionHash":"0x06990881f0b8af53d4a8bdf386531c55373ceb043456c536250b3ea4f5160b33",
"status":1, "out":"0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000a4772656574696e67732100000000000000000000000000000000000000000000"
}
# 10.web3.Ping
Request parameter:
name | type | required | description |
---|---|---|---|
address | string | true | ip+port |
Response parameter:
name | type | required | description |
---|---|---|---|
nodeId | string | true | nodeId |
version | string | true | versions |
isDataNode | bool | true | if it's a data node |
dataNodeOf | int | true | data node |
lastMsgTime | int64 | true | last information time |
lastEventTime | int64 | true | last event time |
lastBlockTime | int64 | true | last block time |
overflow | bool | true | overflow |
lastBlocks | map | true | the last block |
opTypes | map | true | type |
Sample request:
String ipAddress="192.168.1.7:22007";
Map mapPing=web3.Ping(ipAddress);
System.out.println(mapPing);
Response:
{
"nodeId": "0x84385cc16d8e0a47909ee998d51370e5f56d7c85716e045c99760bedb180346da7d00b575ba23b76ffcd0969ae84e1e6b6943ec408f40b44825128577d8a895d",
"version": "V1.0.0",
"isDataNode": false,
"dataNodeOf": 0,
"lastMsgTime": 1563351861,
"lastEventTime": 1563351861,
"lastBlockTime": 1563351860,
"overflow": false,
"lastBlocks": {
"0": 6889,
"1": 6899,
"2": 4176,
"3": 5323,
"4": 3299,
"5": 4993,
"6": 1199
},
"opTypes": {
"0": [
"SPEC"
],
"2": [
"SPEC"
],
"3": [
"COMM"
],
"5": [
"COMM"
]
}
}
# 11. Proof of generation of cheque (web3.RpcMakeVccProof)
Request parameter:
name | type | required | description |
---|---|---|---|
chainId | string | true | chainId |
fromChainId | string | true | the chainID of the The account address of transaction sent |
toChainId | string | true | the ChainID of the The account address of transaction accepted |
from | string | true | the account address of transaction sent |
to | string | true | the account address of transaction accepted |
nonce | string | true | the number of previous transactions till now |
value | string | true | transfer amount |
ExpireHeight | int | true | overdue height |
Response parameter:
name | type | required | description |
---|---|---|---|
input | string | true | proof of the check |
Sample request:
RpcMakeVccProof rpcInfo=new RpcMakeVccProof();
rpcInfo.setChainId("3");
rpcInfo.setFrom("0x2c7536e3605d9c16a7a3d7b1898e529396a65c23");
rpcInfo.setTo("0x4fa1c4e6182b6b7f3bca273390cf587b50b47311");
rpcInfo.setFromChainId("2");
rpcInfo.setToChainId("3");
rpcInfo.setValue("1");
rpcInfo.setExpireheight("284228");
rpcInfo.setNonce("10");
Map mapVccResult=web3.RpcMakeVccProoff(rpcInfo);
System.out.println(mapVccResult);
Response:
{
"input": "0x95000000022c7536e3605d9c16a7a3d7b1898e529396a65c23000000000000000a000000034fa1c4e6182b6b7f3bca273390cf587b50b473110000000000045644010102a227d7c068bc00e1a0cb6566a508a7044b8e5d11ea3f8b359a59c2406b80c6bfb23766f092941093a1a0c05cad87667a882bb66fcc3dbcdd048a82529855fd3c8304999fe7651293d450edc2000080809424930080c20000c07f4b4267a5fe52834d41b3ed6405a1e72e96eb1aec43f6f4c69c42c92bf9661a810005847b691757b57ef3808b5050c3b35e524c23e27203998b6b0665a2529f08ad605e8333471bbdde23213cc02b3d04c688f1e3d4e0e707ad1c9cf2bfad5b2fa770eadc5fc028bf8f8760f5fa69c3621d18a37000082fadf62b870e633cdf47a7c3eca078605c1b0ad6ff4323f7c23307585d3dddd504f96e7a7f722f9802d2a1b766e78588af6a85bab7314a91829366343792f6ff584f719bba43bc3ebc1423a0000110"
}
# 12. Proof of cancellation of cheque(web3.MakeCCCExistenceProof)
Request parameter:
name | type | required | description |
---|---|---|---|
chainId | string | true | chainId |
fromChainId | string | true | the chainID of the The account address of transaction sent |
toChainId | string | true | the ChainID of the The account address of transaction accepted |
from | string | true | the account address of transaction sent |
to | string | true | the account address of transaction accepted |
nonce | string | true | the number of previous transactions till now |
value | string | true | transfer amount |
ExpireHeight | int | true | overdue height |
Response parameter:
name | type | required | description |
---|---|---|---|
input | string | true | arguments when the contract is called |
existence | bool | true | if cheque exists |
Sample request:
MakeCCCExistenceProof parInfo=new MakeCCCExistenceProof();
parInfo.setChainId("3");
parInfo.setFrom("0x2c7536e3605d9c16a7a3d7b1898e529396a65c23");
parInfo.setTo("0x4fa1c4e6182b6b7f3bca273390cf587b50b47311");
parInfo.setFromChainId("3");
parInfo.setToChainId("3");
parInfo.setValue("1");
parInfo.setExpireheight("33772");
parInfo.setNonce("9");
Map mapccc=web3.MakeCCCExistenceProof(parInfo);
System.out.println(mapccc);
Response:
{
"existence": false,
"input": "0x96000000032c7536e3605d9c16a7a3d7b1898e529396a65c230000000000000009000000034fa1c4e6182b6b7f3bca273390cf587b50b4731100000000000083ec010103a2272cc0bc1dd5c595436856c7d7a901a8c4059b1ba44c0bd784817b014302a6c8c4fcb19194a1fe930080c200008080919425930080c20000c013866c071f3ec74b6a5c734f28b4ff2b82c9a274fc439af4c98fa0d979beed5f8100054a3c7dd49fdfc74ef359c98a4c7cd9d4acccbbca7e3febddbcccbb186fcc66764cafef79863477a77e0a3ebc512568f3f49e77c893f3dc635b53ad75b88de8e57f0ee271f516ce7640ff71573df432f30fd39ffaf19eba2bdef8197cbe5ca585eca078605c1b0ad6ff4323f7c23307585d3dddd504f96e7a7f722f9802d2a1b7427ea90f8d2785126ec64ed6f65c7bdc1ec5daf4af7306f8989a38d59ec43948000111"
}
# 13.Get chain structure(web3.GetChainInfo)
Request parameter:
name | type | required | description |
---|---|---|---|
chainIds | []int | true | chainId(tip:null will return all) |
Response parameter:
name | type | required | description |
---|---|---|---|
[] | []chainInfo | true | chain information array |
chainInfo:
name | type | required | description |
---|---|---|---|
chainId | int | true | chainId |
datanodes | []dataNode | true | data node group |
mode | int | true | mode |
parent | int | true | parent |
dataNode:
name | type | required | description |
---|---|---|---|
dataNodeId | int | true | data node id |
dataNodeIp | string | true | data node IP |
dataNodePort | int | true | data node port |
Sample request:
JSONArray result_ChainInfo=web3.GetChainInfo();
System.out.println(result_ChainInfo);
Response:
[
{
"chainId": 0,
"datanodes": [
{
"dataNodeId": "0x5e17128ba224a96d6e84be0c7f899febea26c55c78940610d78a0d22dbd0ab03cc3233491de0b5eb770dbf850b509bd191723df4fc40520bcbab565d46543d6e",
"dataNodeIp": "192.168.1.13",
"dataNodePort": 22010
}
],
"mode": 5,
"parent": 1048576
},
{
"chainId": 1,
"datanodes": [
{
"dataNodeId": "0x96dc94580e0eadd78691807f6eac9759b9964daa8b46da4378902b040e0eb102cb48413308d2131e9e5557321f30ba9287794f689854e6d2e63928a082e79286",
"dataNodeIp": "192.168.1.13",
"dataNodePort": 22014
}
],
"mode": 6,
"parent": 0
},
{
"chainId": 2,
"datanodes": [
{
"dataNodeId": "0xa93b150f11c422d8700554859281be8e34a91a859e0e021af186002c7e4a2661ea2467a63b417030d68e2fdddeb4342943dff13225da77124abf912fd092f71f",
"dataNodeIp": "192.168.1.13",
"dataNodePort": 22018
}
],
"mode": 6,
"parent": 0
},
{
"chainId": 3,
"datanodes": [
{
"dataNodeId": "0x783f4b2490461ecfd8ee8d3451e434de06bacb0ffff56de53a33fe545589094fa0b929eeaa62dc5203d1e831ccdd37d206d0b85b193921efb223bf0cb2f37b4c",
"dataNodeIp": "192.168.1.13",
"dataNodePort": 22022
}
],
"mode": 7,
"parent": 1
},
{
"chainId": 4,
"datanodes": [
{
"dataNodeId": "0x44c98ab831f3ca4553e491bba06753e959ceb55d43e18bc76539572feb1e0dbaf2fbfc19f571d6544e82be1c7c39760f6a023d4be4dcb9473dd580c731d03926",
"dataNodeIp": "192.168.1.13",
"dataNodePort": 22026
}
],
"mode": 7,
"parent": 1
}
]
# 14.Get information of committee members(web3.GetCommittee)
Request parameter:
name | type | required | description |
---|---|---|---|
chainId | string | true | chainId |
epoch | string | true | Epoch rounds |
Response parameter:
name | type | required | description |
---|---|---|---|
chainId | int | true | chainId |
MemberDetails | []string | true | details of the committee |
Epoch | int | true | epoch rounds |
Sample request:
String epoch="1";
String chainId3="3";
JSONArray result_CommitteeInfo=web3.GetCommittee(chainId3,epoch);
System.out.println(result_CommitteeInfo);
Response:
[ "0xfbcd643db7f1812d71f7fb66a9b6c7b877d4b44e707b5788ca041003e7f671c85f88ee79d0642fbd1294b2140e3ef5414b3bb125b92dab11696788a66f949a91",
"0x79d260d785858034d64641b9a5867bd08e3f6cae9a3f18e09dfd1a238808b97093d74a8f1a15d9cbab68b005383a2637cce73110f3dfb5faea0a7c371f0976b9",
"0x7f17a336b3005ef9fed2baabcdc08b31cfcd72ea84acd34b4b468d4b527d0628978ab0e541c5fe1e04d0ad01a7d892ece8920f90e12b8a55c79933167786a196",
"0x6b81e535a8f7b0a3ed746d46e6e1248ebf001650c078f27056a20f00a2c9d3c369865872ba01dcf95485b3dfcfd921a6239b6690166e47ec47ade0e6aea593c1"
]